﻿

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace T2task_qml
{
    class Program
    {
        static void Main(string[] args)
        {
            string qmy = "server=.;database=Task;Integrated Security=true";
            //创建连接对象
            SqlConnection Con = new SqlConnection(qmy);
            Con.Open();
            //查询对象
            string qmy1 = "select *from Game";
            SqlCommand qmy2 = new SqlCommand(qmy1,Con);
            SqlDataReader qmy3 = qmy2.ExecuteReader();
            Console.WriteLine("序号\t游戏名称\t游戏价格\t库存数量\t小计\n----------------------------------------------");
            while (qmy3.Read()) { 
            
            Console.WriteLine("{0}\t{1}\t{2}\t\t{3}\t\t{4}",qmy3[0],qmy3[1],qmy3[2],qmy3[3],qmy3[4]);
            }
            Con.Close();
        }
    }
}
